import { initMixin } from './init'
import { stateMixin } from './state'
import { renderMixin } from './render'
import { eventsMixin } from './events'
import { lifecycleMixin } from './lifecycle'
import { warn } from '../util/index'

function Vue(options) {
  console.log(options)
  console.log(this instanceof Vue)
  // debugger
  // alert(1)
  // 真正的vue构造函数，判断不是生产环境，且不是通过new关键字来创建对象的话

  // instanceof 用于判断一个变量是否某个对象的实例，
  // 在这里的意思是是通过new关键字创建的

  if (process.env.NODE_ENV !== 'production' && !(this instanceof Vue)) {
    warn('Vue is a constructor and should be called with the `new` keyword')
  }
  this._init(options)
}

initMixin(Vue)
stateMixin(Vue)
eventsMixin(Vue)
lifecycleMixin(Vue)
renderMixin(Vue)

export default Vue
